USE NutritionTracker
GO
IF EXISTS (SELECT 1 FROM sysobjects WHERE ID = object_id(N'AppUser_Login') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE AppUser_Login
GO
CREATE PROCEDURE AppUser_Login
(
@EmailAddress	VARCHAR(100),
@Password	VARCHAR(50),
@IPAddress	VARCHAR(11),
@LoginTime	SMALLDATETIME	
)
AS
BEGIN

SET NOCOUNT ON

DECLARE		@AppUserID int,
		@SessionID	uniqueidentifier

SELECT		@AppUserID = AppUserID
FROM		AppUser
WHERE		EmailAddress = @EmailAddress
AND		Password = @Password

EXEC AppUser_Read_Item @AppUserID

SET NOCOUNT OFF

END
GO
GRANT EXECUTE ON AppUser_Login TO NUTRKR_WEB
GO
